﻿using System.Collections.Generic;
using Microsoft.FxCop.Sdk;

namespace LINQtoFxCop.Core
{
  public class TargetCodebase : Node
  {
    private readonly IDictionary<int, ModuleNode> _modules;

    internal TargetCodebase()
      : base(NodeType.Undefined)
    {
      _modules = new Dictionary<int, ModuleNode>();
    }

    internal void Init()
    {
      _modules.Clear();
    }

    internal void AddContent(ModuleNode module)
    {
      if (_modules.ContainsKey(module.UniqueKey))
        return;
      _modules.Add(module.UniqueKey, module);
    }
    internal ApplicationNode Build()
    {
      return new ApplicationNode(_modules.Values);
    }
  }
}
